import { createRouter, createWebHistory } from 'vue-router'
import Home from '@/views/Home.vue'
import DDNSConfig from '@/views/DDNSConfig.vue'
import IPServices from '@/views/IPServices.vue'
import FileServerConfig from '@/views/FileServerConfig.vue'
import About from '@/views/About.vue'

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    meta: { title: '首页' }
  },
  {
    path: '/ddns-config',
    name: 'DDNSConfig',
    component: DDNSConfig,
    meta: { title: 'DDNS配置' }
  },
  // 兼容旧版路径
  {
    path: '/ddns',
    redirect: '/ddns-config'
  },
  {
    path: '/ip-services',
    name: 'IPServices',
    component: IPServices,
    meta: { title: 'IP检测服务' }
  },
  {
    path: '/file-server',
    name: 'FileServerConfig',
    component: FileServerConfig,
    meta: { title: '文件服务器' }
  },
  {
    path: '/about',
    name: 'About',
    component: About,
    meta: { title: '关于' }
  },
  // 默认重定向到首页
  {
    path: '/:pathMatch(.*)*',
    redirect: '/'
  }
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})

export default router 